import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Antd from 'ant-design-vue';
import '@/theme/index.less'
import '@/theme/vxe-table.scss'
import http from '@/services/http'
import './permission' // permission control
import assembly from './components/assembly'; // 加载公共组件
import { VXETable, Edit, Export, Validator, Column,  Table, Checkbox, Grid, Toolbar, Pager, Select, Option } from 'vxe-table'
import XEUtils from 'xe-utils'
import zhCN from 'vxe-table/lib/locale/lang/zh-CN'
VXETable.setup({
  i18n: (key, args) => XEUtils.toFormatString(XEUtils.get(zhCN, key), args)
})

Vue.prototype.$http = http
Vue.config.productionTip = false
Vue.use(Antd);
Vue.use(Edit).use(Export).use(Validator).use(Column).use(Table).use(Checkbox).use(Grid).use(Toolbar).use(Pager).use(Select).use(Option)
// 公共组件首字母大写
Object.keys(assembly).forEach((key) => {
  var name = key.replace(/(\w)/, (v) => v.toUpperCase())
  Vue.component(`ep${name}`, assembly[key])
});

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
